package servicioinformaciongeneralservice;

import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import javax.microedition.xml.rpc.Operation;
import javax.microedition.xml.rpc.Type;
import javax.microedition.xml.rpc.ComplexType;
import javax.microedition.xml.rpc.Element;

public class ServicioInformacionGeneralService_Stub implements ServicioInformacionGeneralService, javax.xml.rpc.Stub {

    private String[] _propertyNames;
    private Object[] _propertyValues;

    public ServicioInformacionGeneralService_Stub() {
        _propertyNames = new String[] { ENDPOINT_ADDRESS_PROPERTY };
        _propertyValues = new Object[] { "http://localhost:8080/WebServices/ServicioInformacionGeneralService" };
    }

    public void _setProperty( String name, Object value ) {
        int size = _propertyNames.length;
        for (int i = 0; i < size; ++i) {
            if( _propertyNames[i].equals( name )) {
                _propertyValues[i] = value;
                return;
            }
        }
        String[] newPropNames = new String[size + 1];
        System.arraycopy(_propertyNames, 0, newPropNames, 0, size);
        _propertyNames = newPropNames;
        Object[] newPropValues = new Object[size + 1];
        System.arraycopy(_propertyValues, 0, newPropValues, 0, size);
        _propertyValues = newPropValues;

        _propertyNames[size] = name;
        _propertyValues[size] = value;
    }

    public Object _getProperty(String name) {
        for (int i = 0; i < _propertyNames.length; ++i) {
            if (_propertyNames[i].equals(name)) {
                return _propertyValues[i];
            }
        }
        if (ENDPOINT_ADDRESS_PROPERTY.equals(name) || USERNAME_PROPERTY.equals(name) || PASSWORD_PROPERTY.equals(name)) {
            return null;
        }
        if (SESSION_MAINTAIN_PROPERTY.equals(name)) {
            return new Boolean(false);
        }
        throw new JAXRPCException("Stub does not recognize property: " + name);
    }

    protected void _prepOperation(Operation op) {
        for (int i = 0; i < _propertyNames.length; ++i) {
            op.setProperty(_propertyNames[i], _propertyValues[i].toString());
        }
    }

    public String[] listarTiposInseguridad() throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
        };

        Operation op = Operation.newInstance( _qname_operation_listarTiposInseguridad, _type_listarTiposInseguridad, _type_listarTiposInseguridadResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
        System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);
        return _res;
    }

    public String validarUsuario(String login, String password) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            login,
            password
        };

        Operation op = Operation.newInstance( _qname_operation_validarUsuario, _type_validarUsuario, _type_validarUsuarioResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        return (String )((Object[])resultObj)[0];
    }

    public String[] listarLugaresUsuario(String login) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            login
        };

        Operation op = Operation.newInstance( _qname_operation_listarLugaresUsuario, _type_listarLugaresUsuario, _type_listarLugaresUsuarioResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
        System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);
        return _res;
    }

    public String ingresarLugar(float latitud, float longitud, String nombreLugar, String loginUsuario) throws java.rmi.RemoteException {
        Object inputObject[] = new Object[] {
            new Float(latitud),
            new Float(longitud),
            nombreLugar,
            loginUsuario
        };

        Operation op = Operation.newInstance( _qname_operation_ingresarLugar, _type_ingresarLugar, _type_ingresarLugarResponse );
        _prepOperation( op );
        op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "" );
        Object resultObj;
        try {
            resultObj = op.invoke( inputObject );
        } catch( JAXRPCException e ) {
            Throwable cause = e.getLinkedCause();
            if( cause instanceof java.rmi.RemoteException ) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }

        return (String )((Object[])resultObj)[0];
    }

    protected static final QName _qname_operation_validarUsuario = new QName( "http://WS.com/", "validarUsuario" );
    protected static final QName _qname_operation_listarTiposInseguridad = new QName( "http://WS.com/", "listarTiposInseguridad" );
    protected static final QName _qname_operation_ingresarLugar = new QName( "http://WS.com/", "ingresarLugar" );
    protected static final QName _qname_operation_listarLugaresUsuario = new QName( "http://WS.com/", "listarLugaresUsuario" );
    protected static final QName _qname_listarTiposInseguridad = new QName( "http://WS.com/", "listarTiposInseguridad" );
    protected static final QName _qname_validarUsuario = new QName( "http://WS.com/", "validarUsuario" );
    protected static final QName _qname_listarLugaresUsuarioResponse = new QName( "http://WS.com/", "listarLugaresUsuarioResponse" );
    protected static final QName _qname_validarUsuarioResponse = new QName( "http://WS.com/", "validarUsuarioResponse" );
    protected static final QName _qname_ingresarLugarResponse = new QName( "http://WS.com/", "ingresarLugarResponse" );
    protected static final QName _qname_listarTiposInseguridadResponse = new QName( "http://WS.com/", "listarTiposInseguridadResponse" );
    protected static final QName _qname_listarLugaresUsuario = new QName( "http://WS.com/", "listarLugaresUsuario" );
    protected static final QName _qname_ingresarLugar = new QName( "http://WS.com/", "ingresarLugar" );
    protected static final Element _type_validarUsuario;
    protected static final Element _type_listarLugaresUsuario;
    protected static final Element _type_ingresarLugar;
    protected static final Element _type_ingresarLugarResponse;
    protected static final Element _type_validarUsuarioResponse;
    protected static final Element _type_listarTiposInseguridadResponse;
    protected static final Element _type_listarLugaresUsuarioResponse;
    protected static final Element _type_listarTiposInseguridad;

    static {
        _type_validarUsuario = new Element( _qname_validarUsuario, _complexType( new Element[] {
            new Element( new QName( "", "login" ), Type.STRING, 0, 1, false ),
            new Element( new QName( "", "password" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_listarTiposInseguridad = new Element( _qname_listarTiposInseguridad, _complexType( new Element[] {
        }), 1, 1, false );
        _type_listarLugaresUsuarioResponse = new Element( _qname_listarLugaresUsuarioResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, Element.UNBOUNDED, false )}), 1, 1, false );
        _type_validarUsuarioResponse = new Element( _qname_validarUsuarioResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_ingresarLugarResponse = new Element( _qname_ingresarLugarResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_ingresarLugar = new Element( _qname_ingresarLugar, _complexType( new Element[] {
            new Element( new QName( "", "latitud" ), Type.FLOAT ),
            new Element( new QName( "", "longitud" ), Type.FLOAT ),
            new Element( new QName( "", "nombreLugar" ), Type.STRING, 0, 1, false ),
            new Element( new QName( "", "loginUsuario" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_listarLugaresUsuario = new Element( _qname_listarLugaresUsuario, _complexType( new Element[] {
            new Element( new QName( "", "login" ), Type.STRING, 0, 1, false )}), 1, 1, false );
        _type_listarTiposInseguridadResponse = new Element( _qname_listarTiposInseguridadResponse, _complexType( new Element[] {
            new Element( new QName( "", "return" ), Type.STRING, 0, Element.UNBOUNDED, false )}), 1, 1, false );
    }

    private static ComplexType _complexType( Element[] elements ) {
        ComplexType result = new ComplexType();
        result.elements = elements;
        return result;
    }
}
